package com.youmu.shop.monitor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.common.util.ExceptionUtil;
import com.result.Result;

/**
 * 
 * <p>Title:MonitorAdvice</p>
 * @author xiongchuan
 * @version	v1.0
 * <p>Date:2016年11月11日上午10:09:09</p>
 * <p>Description:TODO</p>
 */
@ControllerAdvice(annotations = RestController.class)
public class MonitorAdvice {
    public static final Logger logger = LoggerFactory.getLogger(MonitorAdvice.class);

    @ExceptionHandler
    @ResponseBody
    public Result handleException(Exception ex) {

        logger.error(ex.getMessage(), ex);
        return ExceptionUtil.handleException(ex);
    }

}
